<?php 
// Header
$this->set('title_for_layout', __("Tạo mới danh mục sản phẩm", true));
$this->left_menu = 'menu/'.$this->params['controller'];

$params = array(
	//'root'	=>	$this->params['named']['root']
);
if (isset($this->params['plugin'])) {
	$params['plugin'] = $this->params['plugin'];
} else {
	$params['plugin'] = null;
}
if (isset($this->params['named']['root'])) {
	$params['root'] = $this->params['named']['root']; 
}
// Load CSS
echo $this->Html->css('/categories/css/manage/add.css');
echo $this->Html->css('cake.form');

// Load Javascript
echo $this->Html->script('ckeditor/ckeditor_basic');
echo $this->Html->script('/products/js/manage_product_categories/add');
?>
<div class='right_content'>
<h2><?php __("Tạo danh mục mới")?></h2>
<?php echo $session->flash()?>

<div class="buttons atbottom">
	<ul>
		<li><a id='add_facility_link' href="<?php echo $html->url($params + array('controller'=> $this->params['controller'], 'action'	=>	'index'))?>"><?php __("Danh sách danh mục")?></a></li>
        <li><a href="javascript:void(0)" class="save"><?php __("Thêm mới")?></a></li>
	</ul>
</div>
<?php //echo $session->flash()?>

<div class='form'>
<?php 
echo $form->create('ProductCategory', array(
	'url'	=>	$params + array(
		'controller'	=>	$this->params['controller'],	
		'action'		=>	'add'
	),
	'id'		=>	'add_category_form',
	'enctype'	=>	'multipart/form-data'
));
?>
<?php 

echo $form->input('name', array(
	'label'	=>	__("Tên danh mục: <font color='red'>(*)</font>", true),
	'error'	=>	__("Danh mục tin không được để trống", true),
	'size'	=> 50
));

if ($configs['ManageCategory']['add']['show_alias']) {
	echo $form->input('alias', array('label'	=>	__("Alias: ", true)));
}

if (!isset($configs['Category']['deep']) || $configs['Category']['deep'] > 1) {
	echo $form->input('parent_id', array('label'	=>	__("Danh mục cha: ", true), 'options'	=>	$tree));
}

if ($configs['Category']['image']['show']):
$options = array(
	//'name'				=>	$this->data['Article']['image'],
	'name'				=>	'',
	'path'				=>	'files/categories/',
	'field_name'		=>	'image',
	'label'				=>	__('&nbsp;',true),
	'legend_title'		=>	__('Hình ảnh',true),
	//'delete_image_link'	=>	$html->url('/news/manage_news/delete_image/'.$this->data['Article']['id'])
	'delete_image_link'	=>	''
);
echo $html->form_image($options,array());
endif;
?>
<?php if ($configs['Category']['description']['show']):?>
<div class="input">
<table cellpadding='0' cellspacing='0' border='0' width='100%'  class="list-table" class="list-table">
<tr>
	<td class='label' valign='top'><label><?php __("Mô tả: ")?></label></td>
	<td>
		<?php
		echo $form->input('description', array('label'	=>	false, 'div'=>false)); 
		echo $wysiwyg->render("ProductCategory.description", 'ckeditor', array('uiColor'=>'#97da7f'));
        //echo $wysiwyg->render("ProductCategory.description", 'ckeditor');
		?>
	</td>
</tr>
</table>
</div>
<?php endif; ?>
<?php echo $form->end();?>
</div>

<div class="buttons atbottom">
	<ul>
		<li><a id='add_facility_link' href="<?php echo $html->url($params + array('controller'=> $this->params['controller'], 'action'	=>	'index'))?>"><?php __("Danh sách danh mục")?></a></li>
        <li><a href="javascript:void(0)" class="save"><?php __("Thêm mới")?></a></li>
	</ul>
</div>